package com.lml.jdk8.localdate.java8Time;

import java.time.LocalDate;
import java.time.Period;

/**
 * @author luomingliang
 * @date 2023/7/16 20:07
 */
public class PeriodDemo {

    public static void main(String[] args) {
        LocalDate start = LocalDate.of(2020, 8, 10);
        LocalDate end = LocalDate.of(2023, 12, 15);
        //1.创建Period对象，封装两个日期对象
        Period period = Period.between(start, end);
        //2.通过period对象获取两个日期对象相差的信息
        System.out.println("period.getYears() = " + period.getYears());
        System.out.println("period.getMonths() = " + period.getMonths());
        System.out.println("period.getDays() = " + period.getDays());
    }
}
